home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / cl0588.zip / GETCH.C < prev    next >
Text File  |  1988-01-21  |  372b  |  24 lines

  1. /* .subt | Get and save character routines for desktop calculator */
  2.  
  3. #define BUFSIZE  100
  4.  
  5. char buf[BUFSIZE];
  6. int  bufp = 0;
  7.  
  8. getch()
  9. {
  10.   return((bufp > 0) ? buf[--bufp] : getchar());
  11. }
  12.  
  13. ungetch(c)
  14. int c;
  15. {
  16.   if (bufp > BUFSIZE)
  17.      printf("ungetch: too many characters\n");
  18.   else
  19.     buf[bufp++] = c
  20. }
  21.  
  22. /* .subt < end of file, file getch.c */
  23.  
  24.